home *** CD-ROM | disk | FTP | other *** search
- VERSION 2.00
- Begin Form frmMain
- BackColor = &H00C0C0C0&
- Caption = "EMAIL DEMO"
- ClientHeight = 4770
- ClientLeft = 915
- ClientTop = 1440
- ClientWidth = 7065
- Height = 5175
- Left = 855
- LinkTopic = "Form1"
- ScaleHeight = 4770
- ScaleWidth = 7065
- Top = 1095
- Width = 7185
- Begin CommandButton Command5
- Caption = "Compose"
- Height = 315
- Left = 4920
- TabIndex = 13
- Top = 840
- Width = 1095
- End
- Begin CommandButton Command4
- Caption = "Retrieve Message"
- Height = 315
- Left = 1800
- TabIndex = 11
- Top = 840
- Width = 1815
- End
- Begin CommandButton Command3
- Caption = "Disconnect"
- Height = 315
- Left = 3660
- TabIndex = 3
- Top = 840
- Width = 1215
- End
- Begin TextBox tPassword
- Height = 285
- Left = 3720
- PasswordChar = "*"
- TabIndex = 7
- Top = 480
- Width = 1515
- End
- Begin TextBox tUser
- Height = 285
- Left = 1200
- TabIndex = 6
- Top = 480
- Width = 1335
- End
- Begin TextBox tMailServer
- Height = 285
- Left = 1200
- TabIndex = 5
- Top = 120
- Width = 2535
- End
- Begin CommandButton Command2
- Caption = "Reply"
- Height = 315
- Left = 6060
- TabIndex = 4
- Top = 840
- Width = 915
- End
- Begin CommandButton Command1
- Caption = "Check Messages"
- Height = 315
- Left = 60
- TabIndex = 2
- Top = 840
- Width = 1695
- End
- Begin TextBox tMessage
- FontBold = 0 'False
- FontItalic = 0 'False
- FontName = "MS Sans Serif"
- FontSize = 8.25
- FontStrikethru = 0 'False
- FontUnderline = 0 'False
- Height = 1815
- Left = 0
- MultiLine = -1 'True
- ScrollBars = 2 'Vertical
- TabIndex = 1
- Top = 2880
- Width = 6975
- End
- Begin ListBox lMessages
- FontBold = 0 'False
- FontItalic = 0 'False
- FontName = "MS Sans Serif"
- FontSize = 8.25
- FontStrikethru = 0 'False
- FontUnderline = 0 'False
- Height = 1395
- Left = 0
- TabIndex = 0
- Top = 1200
- Width = 6975
- End
- Begin POP POP1
- Height = 420
- Left = 5280
- MailServer = ""
- Password = ""
- RegHandle = EMAIL.FRX:0000
- Top = 0
- User = ""
- Width = 420
- WinsockLoaded = 0 'False
- End
- Begin Label lStats
- BackStyle = 0 'Transparent
- Height = 255
- Left = 120
- TabIndex = 12
- Top = 2640
- Width = 5895
- End
- Begin Label Label1
- BackStyle = 0 'Transparent
- Caption = "Password:"
- Height = 255
- Index = 2
- Left = 2760
- TabIndex = 10
- Top = 540
- Width = 975
- End
- Begin Label Label1
- BackStyle = 0 'Transparent
- Caption = "User:"
- Height = 255
- Index = 1
- Left = 120
- TabIndex = 9
- Top = 540
- Width = 855
- End
- Begin Label Label1
- BackStyle = 0 'Transparent
- Caption = "Mail Server:"
- Height = 255
- Index = 0
- Left = 120
- TabIndex = 8
- Top = 120
- Width = 1095
- End
- Sub Command1_Click ()
- POP1.WinsockLoaded = True
- lMessages.Clear
- If tMailServer = "" Then
- MsgBox "Please supply a valid mail server."
- Exit Sub
- End If
- POP1.User = tUser
- POP1.Password = tPassword
- POP1.MailServer = tMailServer
- POP1.Action = 1 'Connect
- lStats = POP1.MessageCount & " messages " & POP1.TotalSize & " bytes total"
- 'now get the first 15 lines from each message
- '(looking for Subject and some other headers)
- tMessage.Enabled = False
- For gCurrMsg = 1 To POP1.MessageCount
- POP1.MessageNumber = gCurrMsg
- gMessages(gCurrMsg).Size = POP1.MessageSize
- 'reset message data
- gMessages(gCurrMsg).From = ""
- gMessages(gCurrMsg).Subject = "'"
- gMessages(gCurrMsg).Date = "'"
- gMessages(gCurrMsg).AllHeaders = ""
- 'retrieve the first 15 lines
- POP1.MaxLines = 15
- POP1.Action = 3 'Retrieve Message
- 'display some message data
- lMessages.AddItem gCurrMsg & Chr$(9) & gMessages(gCurrMsg).Subject & Chr$(9) & gMessages(gCurrMsg).From & Chr$(9) & " (" & gMessages(gCurrMsg).Size & " bytes)"
- Next gCurrMsg
- End Sub
- Sub Command2_Click ()
- frmSend.tSubject = "Re: " & gMessages(gCurrMsg).Subject
- frmSend.tTo = gMessages(gCurrMsg).From
- frmSend.tFrom = ""
- frmSend.tMessage = ""
- frmSend.Show
- End Sub
- Sub Command3_Click ()
- lMessages.Clear
- tMessage = ""
- POP1.Action = 2 'Disconnect
- End Sub
- Sub Command4_Click ()
- If lMessages.ListIndex < 0 Then
- MsgBox "Please select a message from the list first."
- Exit Sub
- End If
- lMessages_DblClick
- End Sub
- Sub Command5_Click ()
- frmSend.tSubject = ""
- frmSend.tTo = ""
- frmSend.tFrom = ""
- frmSend.tMessage = ""
- frmSend.Show
- End Sub
- Sub Form_Resize ()
- If WindowState <> 1 Then
- lMessages.Width = ScaleWidth
- tMessage.Width = ScaleWidth
- If ScaleHeight - tMessage.Top > 100 Then
- tMessage.Height = ScaleHeight - tMessage.Top
- End If
- End If
- End Sub
- Sub lMessages_Click ()
- lMessages_DblClick
- End Sub
- Sub lMessages_DblClick ()
- gCurrMsg = lMessages.ListIndex + 1
- POP1.MessageNumber = gCurrMsg
- gMessages(gCurrMsg).Size = POP1.MessageSize
- 'reset message data
- gMessages(gCurrMsg).From = ""
- gMessages(gCurrMsg).Subject = "'"
- gMessages(gCurrMsg).Date = "'"
- gMessages(gCurrMsg).AllHeaders = ""
- gMessages(gCurrMsg).Text = ""
- tMessage.Enabled = True 'allow retrieval of text
- tMessage = ""
- POP1.MaxLines = 0 'all lines
- MousePointer = 11
- POP1.Action = 3 'Retrieve Message
- MousePointer = 0
- nl$ = Chr$(13) & Chr$(10)
- tMessage = gMessages(gCurrMsg).Text & nl$ & nl$ & String$(30, "-") & nl$ & gMessages(gCurrMsg).AllHeaders
- tMessage.SelStart = 0
- End Sub
- Sub POP1_Header (Field As String, Value As String)
- gMessages(gCurrMsg).AllHeaders = gMessages(gCurrMsg).AllHeaders & Field & ": " & Value & Chr$(13) & Chr$(10)
- Select Case UCase$(Field)
- Case "SUBJECT": gMessages(gCurrMsg).Subject = Value
- Case "FROM": gMessages(gCurrMsg).From = Value
- Case "DATE": gMessages(gCurrMsg).Date = Value
- End Select
- End Sub
- Sub POP1_PITrail (Direction As Integer, Message As String)
- Debug.Print "POP:" & Direction & ": " & Message
- End Sub
- Sub POP1_Transfer (BytesTransferred As Long, Text As String)
- gMessages(gCurrMsg).Text = gMessages(gCurrMsg).Text & Text & Chr$(13) & Chr$(10)
- End Sub
-